Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow-up fix for PR744 #745

Merged
merged 24 commits into from
Nov 15, 2024
Merged

follow-up fix for PR744 #745

merged 24 commits into from
Nov 15, 2024

Conversation

flohump
Copy link
Contributor

@flohump flohump commented Nov 12, 2024

🐦 Description of this PR 🐦

this PR resolves the following issues:
a) land area is not constant over time
b) infeasibilites in 44_biodiversity module in FSEC runs

  • 10_land Simplified land transition matrix for improved feasibility (removed balance variables!)
  • modules[29-35] added initial vales for ov_bv for better starting point
  • 44_biodiversity bugfix biorealm_biome.cs3 in input data (shares did not add-up to 1)

🔧 Checklist for PR creator 🔧

  • Label pull request from the label list.

    • Low risk: Simple bugfixes (missing files, updated documentation, typos) or changes in start or output scripts
    • Medium risk: Uncritical changes in the model core (e.g. moderate modifications in non-default realizations)
    • High risk: Critical changes in model core or default settings (e.g. changing a model default or adjusting a core mechanic in the model)
  • Self-review own code

    • No hard coded numbers and cluster/country/region names.
    • The new code doesn't contain declared but unused parameters or variables.
    • magpie4 R library has been updated accordingly and backwards compatible where necessary.
    • scenario_config.csv has been updated accordingly (important if default.cfg has been updated)
  • Document changes

    • Add changes to CHANGELOG.md
    • Where relevant, put In-code documentation comments
    • Properly address updates in interfaces in the module documentations
    • run goxygen::goxygen() and verify the modified code is properly documented
  • Perform test runs

    • Low risk:
      • Run a compilation check via Rscript start.R --> "compilation check"
    • Medium risk:
      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
    • High risk:
      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
      • Default run from the PR target branch for comparison
      • Provide relevant comparison plots (land-use, emissions, food prices, land-use intensity,...)

All default test runs including 4 FSEC runs (test_runs.R) are feasible.

Emissions_CO2_Land_Land_use_Change-110
Resources_Land_Cover_Cropland-117
Productivity_Landuse_Intensity_Indicator_Tau-105

📉 Performance changes 📈

  • Current develop branch default : 25 mins
  • This PR's default : 25 mins

🚨 Checklist for reviewer 🚨

  • PR is labeled correctly
  • Code changes look reasonable
    • No hard coded numbers and cluster/country/region names.
    • No unnecessary increase in module interfaces
    • model behavior/performance is satisfactory.
  • Changes are properly documented
    • CHANGELOG is updated correctly
    • Updates in interfaces have been properly addressed in the module documentations
    • In-code documentation looks appropriate
  • content review done (at least 1)
  • RSE review done (at least 1)


q10_transition_to(j2,land_to) ..
sum(land_from, vm_lu_transitions(j2,land_from,land_to)) =e=
vm_land(j2,land_to);

q10_transition_from(j2,land_from) ..
sum(land_to, vm_lu_transitions(j2,land_from,land_to)) =e=
vm_land.l(j2,land_from) + v10_balance_positive(j2,land_from) - v10_balance_negative(j2,land_from);
pcm_land(j2,land_from);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not vm_land.l? I thought this was one of the points of PR before to have here same accuracy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out that vm_land.l and pcm_land differ considerably.
It seems that vm_land.l is not updated in all realizations.

@flohump flohump added High risk Higher risk bugfix labels Nov 13, 2024
@flohump flohump marked this pull request as ready for review November 13, 2024 10:13
Copy link
Contributor

@pascal-sauer pascal-sauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

config/default.cfg Show resolved Hide resolved
@@ -30,3 +30,5 @@ sets
OC1,OC2,OC7,NT3,NT4,NT7,NT8,NT10,NT12,NT13,NT14,PA11,PA12,PA13,NA5,PA1,PA4,PA5,PA6,
PA8,PA9,PA10,AN99,AT98,NA2,NA6,NA7,NA12,NA99,PA98,PA99,AA12,AA13 /
;

alias(biome44,biome44_2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this alias needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for the calculation of i44_biome_share(j,biome44)

i44_biome_share(j,biome44) = 
   (f44_biome_area(j,biome44) + 1e-10) / sum(biome44_2, f44_biome_area(j,biome44_2) + 1e-10);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why does it not work to just use biome44 instead of biome44_2 everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the set biome44 is already under control. It's just not possible in GAMS to do this operation with the same set.

Copy link
Contributor

@pascal-sauer pascal-sauer Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, under control means it appears on the left hand side of the equation (or is it an assignment?)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under control in GAMS means that all calculations are done for each set element.

Copy link
Contributor

@pvjeetze pvjeetze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for these extensive and fast updates!

I requested some minor changes.

In addition we should have again a discussion and a decision in the MAgPIE meeting on how to deal with project-specific scenario configs.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -19,5 +19,5 @@ gms$s15_exo_alcohol;1;1;1
gms$s15_alc_scen;0;0;0
gms$factor_costs;sticky_labor;sticky_labor;sticky_labor
gms$c70_feed_scen;ssp1;ssp2;ssp2
input['cellular'];rev4.115EL2_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz;;
input['cellular'];rev4.116EL2_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure, whether we'd come up with a final decision on this, but I thought that it is now in the responsibility of the people taking care of the respective projects to keep the project-specific scenario_configs up to date. Similar as with the project related start scripts?
Maybe we could have a dedicated discussion on this again in the MAgPIE meeting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up. Let's discuss about this in the MAgPIE meeting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FSEC scenario config maybe a separate case, or maybe even not (see comment above). One idea of splitting the project specific settings from the main scenario_config was that for general developments only the main scenario_config must be updated and thereby taking away the burden of also maintaining project-specific ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use FSEC in our default test runs, it should be updated from my view.

modules/44_biodiversity/bii_target/equations.gms Outdated Show resolved Hide resolved
modules/44_biodiversity/bii_target/preloop.gms Outdated Show resolved Hide resolved
modules/44_biodiversity/bii_target/presolve.gms Outdated Show resolved Hide resolved
modules/44_biodiversity/bii_target_apr24/preloop.gms Outdated Show resolved Hide resolved
modules/44_biodiversity/bii_target_apr24/presolve.gms Outdated Show resolved Hide resolved
@flohump flohump requested a review from pvjeetze November 14, 2024 08:41
Copy link
Contributor

@pvjeetze pvjeetze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates. Looks good for me now.

I only have a minor addtional comment regarding the placement of code in the preloop.

modules/44_biodiversity/bii_target/preloop.gms Outdated Show resolved Hide resolved
modules/44_biodiversity/bii_target_apr24/preloop.gms Outdated Show resolved Hide resolved
@flohump flohump merged commit 408e5a8 into magpiemodel:develop Nov 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants